package com.thinkingdata.datax.plugin.writer.exption;

import com.alibaba.datax.common.spi.ErrorCode;

/**
 * @author: Felix.Wang
 * @email: Felix@thinkingdata.cn
 * @date: 2019/8/22-14:47
 * @describe: 错误码
 */
public enum TaDataWriterErrorCode implements ErrorCode {

    APPID_NULL("APPID_NULL", "appid为空，请确认."),
    APPID_ERROR("APPID_ERROR", "APPID错误，请确认"),
    RECEIVER_PORT_NULL("RECEIVER_PORT_NULL", "端口为空，请确认."),
    PUSH_URL("PUSH_URL", "接受地址为空，请确认"),
    KAFKA_PORT_NULL("KAFKA_PORT_NULL", "KAFKA端口为空，请确认."),
    KAFKA_TOPIC_NULL("KAFKA_TOPIC_NULL", "KAFKATOPIC为空，请确认"),
    KAFKA_SERVER_NULL("KAFKA_SERVER_NULL", "KAFKA地址为空，请确认"),
    TYPE_NULL("TYPE_NULL", "数据类型为空，请确认"),
    TYPE_ERROR("TYPE_ERROR", "数据类型错误，请确认"),
    CONN_TYPE_ERROR("CONN_TYPE_ERROR", "连接类型错误，请确认"),
    ID_ERROR("ID_ERROR", "[#account_id]与[#distinct_id]不能都不存在"),
    TIME_ERROR("TIME_ERROR", "[#time]字段不存在"),
    EVENT_NAME_ERROR("EVENT_NAME_ERROR", "配置中[#event_name]字段不存在"),
    NOT_SUPPORT_TYPE("NOT_SUPPORT_TYPE", "不支持的类型"),
    RETRY_NUM("RETRY_NUM", "RETRY_NUM不能为空");


    private final String code;

    private final String description;

    private TaDataWriterErrorCode(String code, String description) {
        this.code = code;
        this.description = description;
    }

    @Override
    public String getCode() {
        return this.code;
    }

    @Override
    public String getDescription() {
        return this.description;
    }

    @Override
    public String toString() {
        return String.format("Code:[%s], Description:[%s]. ", this.code,
                this.description);
    }
}
